***Burnout JBPA Data Share
**Code written by Danielle McLaughlin: mclaughdi@mail.uc.edu
**Last update: 01/10/2021

**NOTE: Stata 15 (or higher) is needed to run this code
**NOTE: The following package is required: 


	
**Summary Statistics
clear
set more off
use "/Users/daniellemclaughlin/Desktop/fulldatafile_corrected_08302019v2.dta"
drop if paranadum==1
collapse efficforum fairforum impactforum contribforum freqforum conflforum forumcount uncertain science experience govtype tampadum calidum, by(forumid)
sum efficforum fairforum impactforum contribforum freqforum conflforum forumcount uncertain science experience govtype if tampadum==1
sum efficforum fairforum impactforum contribforum freqforum conflforum forumcount uncertain science experience govtype if tampadum==0


**CA Delta Data Prep
*DVs -- contribute, impact, fairness, efficacy
*IVs -- conflict, frequency, breadth (forumcount), political knowledge (uncertain), scientific knowledge, experience, gov type
*Spatial -- DVs and frequency 
clear
set more off
use "/Users/daniellemclaughlin/Desktop/fulldatafile_corrected_08302019v2.dta"

drop if forumid==.
drop if paranadum==1
drop if tampadum==1

collapse efficforum fairforum impactforum contribforum freqforum conflforum forumcount uncertain science experience govtype, by(forumid)
**save data for CA Delta 


***SDM Model
**read in W matrix 
use "/Users/daniellemclaughlin/Desktop/Burnout_RR/W_Cali_Forums_Prop.dta"
gen id = _n
spset id 

spmatrix fromdata W = participation*, normalize(spectral) replace 
spmatrix summarize W

**read in data for CA Delta 
use "/Users/daniellemclaughlin/Desktop/ca.dta", clear

gen id = _n
spset id 

spregress contribforum conflforum freqforum forumcount uncertain science experience govtype, ml dvarlag(W) ivarlag(W:freqforum) force vce(robust)
estat impact
spregress impactforum conflforum freqforum forumcount uncertain science experience govtype, ml dvarlag(W) ivarlag(W:freqforum) force vce(robust)
estat impact
spregress efficforum conflforum freqforum forumcount uncertain science experience govtype, ml dvarlag(W) ivarlag(W:freqforum) force vce(robust)
estat impact
spregress fairforum conflforum freqforum forumcount uncertain science experience govtype, ml dvarlag(W) ivarlag(W:freqforum) force vce(robust)
estat impact


**Tampa Bay Data Prep
*DVs -- contribute, impact, fairness, efficacy
*IVs -- conflict, frequency, breadth (forumcount), political knowledge (uncertain), scientific knowledge, experience, gov type
*Spatial -- DVs and frequency 
clear
set more off
use "/Users/daniellemclaughlin/Desktop/fulldatafile_corrected_08302019v2.dta"

drop if forumid==.
drop if paranadum==1
drop if calidum==1

collapse efficforum fairforum impactforum contribforum freqforum conflforum forumcount uncertain science experience govtype, by(forumid)
**save data for Tampa Bay

***SDM Model

**read in W matrix 
use "/Users/daniellemclaughlin/Desktop/Burnout_RR/W_Tampa_Forums_Prop.dta"
gen id = _n
spset id 

spmatrix fromdata W = participation*, normalize(spectral) replace 
spmatrix summarize W

**read in data for Tampa Bay
use "/Users/daniellemclaughlin/Desktop/Tampa.dta", clear 

gen id = _n
spset id 

spregress contribforum conflforum freqforum forumcount uncertain science experience govtype, ml dvarlag(W) ivarlag(W:freqforum) force vce(robust)
estat impact
spregress impactforum conflforum freqforum forumcount uncertain science experience govtype, ml dvarlag(W) ivarlag(W:freqforum) force vce(robust)
estat impact
spregress efficforum conflforum freqforum forumcount uncertain science experience govtype, ml dvarlag(W) ivarlag(W:freqforum) force vce(robust) 
estat impact
spregress fairforum conflforum freqforum forumcount uncertain science experience govtype, ml dvarlag(W) ivarlag(W:freqforum) force vce(robust)
estat impact


